Skip to content

chore(i18n): remove dead rewards.* keys from zh-CN#1172

Open
pftom wants to merge 1 commit intonexu-io:mainfrom
pftom:chore/remove-dead-rewards-i18n-keys
Open

chore(i18n): remove dead rewards.* keys from zh-CN#1172
pftom wants to merge 1 commit intonexu-io:mainfrom
pftom:chore/remove-dead-rewards-i18n-keys

Conversation

@pftom
Copy link
Copy Markdown

@pftom pftom commented Apr 23, 2026

Summary

Removes two dead i18n keys from apps/web/src/i18n/locales/zh-CN.ts that have no counterparts in en.ts and are not referenced anywhere in source.

  • rewards.badge → 奖励中心
  • rewards.refresh → 刷新

After the change, en.ts and zh-CN.ts have exactly the same set of 1052 keys, restoring full locale parity.

Why this is safe

Two pre-existing test assertions already guard that these raw key strings do not appear in rendered markup:

  • apps/web/tests/home.test.tsx:322-323
  • tests/web/home.test.tsx:402-403
expect(markup).not.toContain("rewards.badge");
expect(markup).not.toContain("rewards.refresh");

A repo-wide search (rg "rewards\.(badge|refresh)") finds zero positive usages outside the locale file itself and those guard assertions — so removing the translations cannot surface the keys at runtime.

Test plan

  • rg "rewards\.badge|rewards\.refresh" outside zh-CN.ts shows only the negative guard tests.
  • Locale-key diff: en.tszh-CN.ts is now empty in both directions (1052 keys each).
  • pnpm lint
  • pnpm -C apps/web typecheck
  • pnpm test (root vitest — covers tests/web/home.test.tsx)
  • pnpm -C apps/web test (covers apps/web/tests/home.test.tsx)

Out of scope

  • A type-level parity guard (e.g. const zhCN: typeof en) would prevent this drift in the future; deferred to a separate PR.
  • The duplicate tests/web/home.test.tsx vs apps/web/tests/home.test.tsx files contain near-identical guard assertions; consolidation is out of scope.

Generated with the auto-github-contributor skill.

`rewards.badge` and `rewards.refresh` are defined only in zh-CN.ts,
have no counterparts in en.ts, and are not referenced anywhere in
source. Existing guard tests at apps/web/tests/home.test.tsx:322-323
and tests/web/home.test.tsx:402-403 already assert these raw keys
never appear in rendered markup — confirming they are dead
translations.

After this change, en.ts and zh-CN.ts both expose exactly 1052 keys,
restoring full locale parity.
@lefarcen lefarcen self-requested a review April 23, 2026 13:11
Copy link
Copy Markdown
Collaborator

@lefarcen lefarcen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @pftom! 🎉

Wow, what a clean and thoughtful chore PR—removing dead i18n keys while carefully documenting safety and test coverage. Love the thorough verification (rg search + test assertions + key parity check) 🙌

This looks solid—no issues found. Verified no usages outside zh-CN.ts except the guard tests you mentioned. Great out-of-scope notes on type-level guards and test consolidation too.

We'll merge promptly. Questions? Push here!

Join communities:

Thanks for making Nexu better!
Nexu Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants